﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Reverse string</title>
    <link href="Styles/js-console.css" rel="stylesheet" />
    <script src="Scripts/isValidInput.js"></script>
</head>
<body>
    <div id="task">
        <p>
            Write a JavaScript function reverses string and returns itExample: "sample" -> "elpmas".
        </p>
        <a href="2.html">Next task</a>
    </div>

    <br />
    <label for="input">Enter string:</label>
    <input type="text" id="input" />
    <button onclick="ReverseString()">Reverse string</button>

    <div id="js-console"></div>
    <script src="Scripts/js-console.js"></script>

    <script>
        function ReverseString() {
            var inputString = document.getElementById("input").value;
            jsConsole.writeLine(inputString.split("").reverse().join("")); //easy way
        }
    </script>
</body>
</html>
